1 namespace ProceduralToolkit.Examples
2 {

3     ///
<summary>
4     ///
Maze graph edge
5     ///
</summary>
6     
public class Edge
7     {
8         
public Cell origin;
9         
public Cell exit;
10
11         
public Edge(int x, int y, Directions direction, int depth)
12         {
13             origin =
new Cell {direction = direction, x = x, y = y, depth = depth};
14             exit =
new Cell {x = x, y = y, depth = depth + 1};
15
16             
if (origin.direction == Directions.Left)
17             {
18                 exit.direction = Directions.Right;
19                 exit.x--;
20             }
21             
else if (origin.direction == Directions.Right)
22             {
23                 exit.direction = Directions.Left;
24                 exit.x++;
25             }
26             
else if (origin.direction == Directions.Down)
27             {
28                 exit.direction = Directions.Up;
29                 exit.y--;
30             }
31             
else if (origin.direction == Directions.Up)
32             {
33                 exit.direction = Directions.Down;
34                 exit.y++;
35             }
36         }
37     }
38 }


Gõ tìm kiếm nhanh...